<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
<script>
    const info = {
        userName:"小学"
    }
    let userName = info.userName;
    // 拦截:第一个参数是要拦截的对象，第二个参数是要拦截的对象属性名
    // 第三个参数描述
    Object.defineProperty(info,"userName",{
        get(){
            console.log("info->userName->get");
            return "《"+userName+"》";
        },
        set(v){
            console.log("info->userName->set",v);
            userName = v;
        }
    })
    info.userName = "初中";
    console.log(info.userName);
</script>

</html>